package com.hotai.controller;

import com.hotai.comment.dtos.ResponseResult;
import com.hotai.service.UserService;
import com.hotai.service.UserTeacherService;
import com.hotai.vo.equipment.EquipmentList;
import com.hotai.vo.user.LoginDto;
import com.hotai.vo.userteacher.GuanTeacherPageList;
import com.hotai.vo.userteacher.InstitlionTear;
import com.hotai.vo.userteacher.TeaXiuGai;
import com.hotai.vo.userteacher.TearImprot;
import com.hotai.vo.usestudent.UserStudentXUedetaile;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/tearUser")
@CrossOrigin
public class UserTeacherController {
    @Autowired
    private UserTeacherService userTeacherService;

    @PostMapping("/loginUser")
    public ResponseResult login(@RequestBody LoginDto dto) {
        return userTeacherService.login(dto);
    }


    //管理端用户 list
    @RequestMapping("/list")
    private ResponseResult EuipmentList(EquipmentList query){
        return  userTeacherService.EuipmentPage(query);
    }


    @RequestMapping("/TeaDetail")
    private ResponseResult  Teadetail(@Param("query") GuanTeacherPageList query){
        return    userTeacherService.TeacherDetail(query);
    }
    //重置
    @RequestMapping("/chongzhi")
    private ResponseResult  TeadetailChongZhe(@Param("id") Integer id){
        return    userTeacherService.TeacherChonzhe(id);
    }
    //基本信息
    @RequestMapping("/jinBen")
    private ResponseResult  TeadetailJinBan(@Param("id") Integer id){
        return    userTeacherService.TeacherJinBenDetail(id);
    }
//修改密码
    @RequestMapping("/xiuGai")
    private ResponseResult  TeaXiuGai(@RequestBody @Validated TeaXiuGai teaXiuGai){
        return    userTeacherService.XiuGaiTead(teaXiuGai);
    }

    @RequestMapping("/xiuGaiPhone")
    private ResponseResult  TeaXiuGaiPhne(@RequestBody @Validated TeaXiuGai teaXiuGai){
        return    userTeacherService.XiuGaiTeadPhone(teaXiuGai);
    }

    @RequestMapping("/Daochu")
    private ResponseResult TearDaochu(HttpServletRequest request, HttpServletResponse response) {
        return userTeacherService.Daochu(request, response);
    }

    @RequestMapping("/import")
    public ResponseResult TearImprot(HttpServletRequest request, HttpServletResponse response, MultipartFile file) throws Exception {
        return userTeacherService.improtStu(request, response, file);
    }

    @RequestMapping("/importAdd")
    public ResponseResult TearImprotAdd(@RequestBody TearImprot tearImprot){
        return userTeacherService.improtAdd(tearImprot);
    }

    //限制
    @RequestMapping("/UpdateShe")
    private ResponseResult InstitutioxianShe(@Param("id") Integer id){
        return    userTeacherService.UpdateSheXian(id);
    }


    //多选限制
    @RequestMapping("/UpdateSheQuan")
    private ResponseResult InstitutioxianShe(@Param("ide") String ide){
        return    userTeacherService.UpdateSheXuan(ide);
    }

    //机构添加教师
    @RequestMapping("/TearAdd")
    private ResponseResult InstitutioxianTearAdd(@RequestBody InstitlionTear institlionTear){
        return    userTeacherService.InstitlinTear(institlionTear);
    }



}
